<?php


namespace Datacore\Service;


use Datacore\dao\CategoryDao;

class CategoryService
{
    public static function getCategoryList($where,$parms)
    {
        $dao = new CategoryDao();
        $totle = $dao->count($where);
        $Page       = new \Think\Page($totle,25);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show       = $Page->show();// 分页显示输出
        $Entity     = $dao->findWhereOrderBy($where,'sort desc',$Page->firstRow,$Page->listRows);
        foreach($Entity as $key=>$map){
            $list[$key]['cid'] = $map->getId();
            $list[$key]['title'] = $map->getName();
            $list[$key]['level'] = $map->getCat_level();
        }
        return ['Page'=>$show ,'list'=>$list];
    }
}